package spynx.desl.runtime.operators.impl;

import spynx.desl.runtime.IExecutionContext;
import spynx.desl.runtime.IOperator;

public class SelectOperator implements IOperator {

	@Override
	public String getOperator() {
		return "?";
	}

	@Override
	public Object apply(IExecutionContext context, String operator,
			Object... args) {
		boolean condition = (Boolean) context.resolveValue(args[0]);
		if (condition)
			return context.resolveValue(args[1]);
		else
			return context.resolveValue(args[2]);
	}

}
